'use strict'


// 用户的 角色类型
const USER_ROLE = {
  General: 10, // 普通用户
  Member: 20, // 会员用户
}
// 用户的 状态
const USER_STATUS = {
  forbid: 0, // 禁用
  active: 1, // 激活
}
// 用户的 登录 方式
const LOGIN = {
  ACCOUNT: 100, // 账号（username,password）
  EMAIL: 200, // 邮箱
  MINI: 300, // 小程序(openid)
  ZHU: 500  //手机登录
}
// 用户的 注册 方式
const REGISTER = {
  ACCOUNT: 100, // 账号（username,password）
  EMAIL: 200, // 邮箱
  MINI: 300, // 小程序(openid)
  ZHU: 500 //手机注册
}

// 管理后台的 角色类型
const ADMIN_USER_ROLE = {
  ROOT_ADMIN_USER: 'admin',
  ROOT_WAREHOUSE_USER: 'warehouse', //仓库管理员
  ROOT_OPERATION_USER: 'operation', //运营角色
  avatar: "https://qingshou2020.oss-cn-hangzhou.aliyuncs.com/img/qs-logo.png"
}
//用户的性别，值为1时是男性，值为2时是女性，值为0时是未知
const USER_SEX = {
  MALE: 1,
  FEMALE: 2,
  UNKNOWN: 0
}

const DEVICE = {
  IOS: 1,
  ANDROID: 2,
  H5: 3
}
//file meta type
const FILEMETATYPE = {
  img: 'img',
  pdf: 'pdf',
  audio: 'audio',
  video: 'video',
  excel: 'excel',
}


const PLAYTYPE = {
  type1: ['01', '01'],
  type2: ['02', '02'],
  type3: ['03', '03'],
  type4: ['04', '04'],
  type5: ['05', '05'],
  type6: ['06', '06'],
  type7: ['07', '07'],
  type8: ['08', '08'],
  type9: ['09', '09'],
}


const ANSWER = {
  FIR: 0,
  SEC: 1,
  THI: 2,
  FOR: 3,
  FIF: 4,
  SIX: 5
}

const COMMBOOL = {
  RIGHT: true,
  BEAR: false
}

const BANNER_BELONG_MAP = {
  1 : "首页"
}

const BANNER_BELONG_LIST = [
  {
    name: '首页',
    value: 1
  }

]

const BANNER_OPEN_TYPE_MAP = {
  1 : "不设置",
  2 : "跳转普通网页",
  3 : "跳转小程序页面"
}

const BANNER_OPEN_TYPE_LIST = [
  {
    name: '不设置',
    value: 1
  },
  {
    name: '跳转普通网页',
    value: 2
  },
  {
    name: '跳转小程序页面',
    value: 3
  },

]

const ENTERPRISE_SCALE_LIST = [
  {
    name: '小于50',
    value: 1,
  },
  {
    name: "100-499",
    value: 2,
  },
  {
    name: "大于500",
    value: 3,
  }

];

const ENTERPRISE_SCALE_MAP = {
  1: "小于50",
  2: "100-499",
  3: "大于500"
}


const ENTERPRISE_INDUSTRY_LIST = [
  {
    name: "农、林、牧、渔业",
    value: 1,  
  },
  {
    name: "采掘业",
    value: 2,  
  },
  {
    name: "制造业",
    value: 3,  
  },
  {
    name: "电力、煤气及水的生产和供应业",
    value: 4,  
  },
  {
    name: "建筑业",
    value: 5,  
  },
  {
    name: "地质勘查业、水利管理业",
    value: 6,  
  },
  {
    name: "交通运输、仓储及邮电通信业",
    value: 7,  
  },
  {
    name: "批发和零售贸易、餐饮业",
    value: 8,  
  },
  {
    name: "金融、保险业",
    value: 9,  
  },
  {
    name: "房地产业",
    value: 10,  
  },
  {
    name: "社会服务业",
    value: 11,  
  },
  {
    name: "卫生、体育和社会福利业",
    value: 12,  
  },
  {
    name: "教育、文化艺术及广播电影电视业",
    value: 13,  
  },
  {
    name: "科学研究和综合技术服务业",
    value: 14,  
  },
  {
    name: "其他行业",
    value: 15,  
  },
]


const ENTERPRISE_INDUSTRY_MAP = {
  1: "农、林、牧、渔业",
  2: "采掘业",
  3: "制造业",
  4: "电力、煤气及水的生产和供应业",
  5: "建筑业",
  6: "地质勘查业、水利管理业",
  7: "交通运输、仓储及邮电通信业",
  8: "批发和零售贸易、餐饮业",
  9: "金融、保险业",
  10: "房地产业",
  11: "社会服务业",
  12: "卫生、体育和社会福利业",
  13: "教育、文化艺术及广播电影电视业",
  14: "科学研究和综合技术服务业",
  15: "其他行业",
}

const ANSWER_STYLE_LIST = [
  {
    name: "单选题",
    value: 1,  
  },
  {
    name: "多选题",
    value: 2,  
  },
  {
    name: "判断题",
    value: 3,  
  },
  // {
  //   name: "简答题",
  //   value: 4,  
  // }
];


const ANSWER_STYLE_MAP = {
  1: "单选题",
  2: "多选题",
  3: "判断题",
  // 4: "简答题",
}

const ANSWER_STYLE_KEY = {
  singleChoice: 1,
  multipleChoice: 2,
  judge: 3,
  shortAnswer: 4,
}

const ANSWER_LETTER_LIST = [
  "A",
  "B",
  "C",
  "D",
  "E",
  "F",
  "G",
  "H",
  "I",
  "J",
  "K",
  "L",
]

const SETTING_TYPE_KEY = {
  privacy_policy: 1,
  simulation_setting: 2
};

const SETTING_TYPE_LIST = [
  // {
  //   name:'服务条款及隐私政策',
  //   value:1,
  // },
  {
    name:'模拟考试设置',
    value:2,
  }
]

const SETTING_TYPE_MAP = {
  1: "服务条款及隐私协议",
  2: "模拟考试设置"
}


const TRAINING_STYLE_LIST = [
  {
    name: "视频",
    value: 1,  
  },
  {
    name: "文档",
    value: 2,  
  },
];


const TRAINING_STYLE_MAP = {
  1: "视频",
  2: "文档",
}

const TRAINING_STYLE_KEY = {
  video: 1,
  file: 2
};

const EDUCATION_MAP = {
  1:"小学",
  2:"初中",
  3:"高中",
  4:"中专",
  5:"大专",
  6:"本科",
  7:"研究生",
  8:"硕士",
  9:"博士",
  10:"博士后",
}

const EDUCATION_LIST = [
  {
    name: "小学",
    value: 1,
  },
  {
    name: "初中",
    value: 2,
  },
  {
    name: "高中",
    value: 3,
  },
  {
    name: "中专",
    value: 4,
  },
  {
    name: "大专",
    value: 5,
  },
  {
    name: "本科",
    value: 6,
  },
  {
    name: "研究生",
    value: 7,
  },
  {
    name: "硕士",
    value: 8,
  },
  {
    name: "博士",
    value: 9,
  },
  {
    name: "博士后",
    value: 10,
  },
]

const GENDER_LIST = [
  {
    name: "男",
    value: 1,
  },
  {
    name: "女",
    value: 2,
  },
  {
    name: "未知",
    value: 0,
  },
]

const TRAINING_TYPE_LIST = [
  {
    name: "初训",
    value: 1,
  },
  {
    name: "复训",
    value: 2,
  },
  {
    name: "岗前",
    value: 3,
  },
  {
    name: "岗中",
    value: 4,
  },
  {
    name: "调岗",
    value: 5,
  },
  {
    name: "厂级",
    value: 6,
  },
  {
    name: "部门级",
    value: 7,
  },
  {
    name: "岗位级",
    value: 8,
  }
]

const TRAINING_TYPE_MAP = {
  1: "初训",
  2: "复训",
  3: "岗前",
  4: "岗中",
  5: "调岗",
  6: "厂级",
  7: "部门级",
  8: "岗位级"
}

const TEMPLATE_TYPE_LIST = [
  {
    name: "成员模板",
    value: 1
  },
  {
    name: "题干模板",
    value: 2
  }
]

const EXAM_TYPE = {
  1: "正式考试",
  2: "模拟考试"
}

// 设备类型
const EQUIPMENT_TYPE_LIST = [
  {name: "温度传感器", value: 1},
  {name: "气体浓度传感器", value: 2},
]

const EQUIPMENT_TYPE_MAP = {
  1: "温度传感器",
  2: "气体浓度传感器"
}

// 设备状态
const MACHINE_STATUS_LIST = [
  {value: 1, name: "正常"},
  {value: 2, name: "异常"},
  {value: 3, name: "中止"},
]
const MACHINE_STATUS_MAP = {
  1: "正常",
  2: "异常",
  3: "中止",
}

// 数值状态
const NUM_STATUS_LIST = [
  {value: 1, name: "正常"},
  {value: 2, name: "异常"},
]
const NUM_STATUS_MAP = {
  1: "正常",
  2: "异常",
}


const SEND_SETTING = {
  1: "越线即发送",
  2: "1分钟内出现5次预警即发送"
}

const SEND_MSG_STATUS = {
  1: "正常",
  2: "异常发送中",
  3: "关闭",
}

// 短信发送状态
const SEND_STATUS = {
  1: "待发送",
  2: "已发送",
  3: "发送异常"
}

// 气体类型
const GAS_TYPE = {
  "C3H6": "丙烯",
  "O2": "氧气",
  "C3H8": "丙烷",
  "C2H2": "乙炔",
}



// 对象转List
function map2List(originMap,hasCovNum = true){
  return Object.entries(originMap).map(item => {
    return {
      name: item[1],
      value: hasCovNum ? +item[0] : item[0]
    }
  })
}


module.exports = {
  map2List,
  SEND_SETTING,
  SEND_SETTING_LIST: map2List(SEND_SETTING),
  SEND_MSG_STATUS,
  SEND_MSG_STATUS_LIST: map2List(SEND_MSG_STATUS),
  SEND_STATUS,
  GENDER_LIST,
  TEMPLATE_TYPE_LIST,
  USER_ROLE,
  USER_STATUS,
  LOGIN,
  REGISTER,
  ADMIN_USER_ROLE,
  USER_SEX,
  DEVICE,
  PLAYTYPE,
  FILEMETATYPE,
  ANSWER,
  COMMBOOL,
  BANNER_BELONG_MAP,
  BANNER_BELONG_LIST,
  BANNER_OPEN_TYPE_MAP,
  BANNER_OPEN_TYPE_LIST,
  ENTERPRISE_SCALE_LIST,
  ENTERPRISE_SCALE_MAP,
  ENTERPRISE_INDUSTRY_LIST,
  ENTERPRISE_INDUSTRY_MAP,
  ANSWER_STYLE_LIST,
  ANSWER_STYLE_MAP,
  ANSWER_STYLE_KEY,
  ANSWER_LETTER_LIST,
  SETTING_TYPE_KEY,
  SETTING_TYPE_LIST,
  SETTING_TYPE_MAP,
  TRAINING_STYLE_LIST,
  TRAINING_STYLE_MAP,
  TRAINING_STYLE_KEY,
  EDUCATION_MAP,
  EDUCATION_LIST,
  TRAINING_TYPE_LIST,
  TRAINING_TYPE_MAP,
  EQUIPMENT_TYPE_LIST,
  EQUIPMENT_TYPE_MAP,
  MACHINE_STATUS_LIST,
  MACHINE_STATUS_MAP,
  NUM_STATUS_LIST,
  NUM_STATUS_MAP,
  GAS_TYPE
}